<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>Insert title here</title>
		<link rel="stylesheet" type="text/css" href="js/bootstarp-3.3.7/css/bootstrap.min.css" />
		<script src="js/jquery-3.2.0.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/bootstarp-3.3.7/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" type="text/css" href="js/bootstarp-table-1.11.1/bootstrap-table.min.css" />
		<script src="js/bootstarp-table-1.11.1/bootstrap-table.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/bootstarp-table-1.11.1/bootstrap-table-zh-CN.min.js" type="text/javascript" charset="utf-8"></script>

		<script type="text/javascript">
			$(function() {

				$("#tab").bootstrapTable({
					url: "sysorder/sysorderall.lgg",
					pagination: true,
					pageSize: 5,
					queryParams: queryParams,
					columns: [{
						field: 'cus_order_no',
						title: '调度号',
						align: 'center',
					}, {
						field: 'trucktype',
						title: '调度类型',
						align: 'center',
					}, {
						field: 'statusname',
						title: '状态',
						align: 'center',
					}, {
						title: '提交',
						align: 'center',
						formatter: function(value, row, index) {
							//						return '<button onclick="sysorderaup(' + row.user_id + ')" class="btn btn-info glyphicon glyphicon-edit"></button>'
						}
					}, {
						title: '更新',
						align: 'center',
						formatter: function(value, row, index) {
							//						return '<button onclick="sysorderaup(' + row.user_id + ')" class="btn btn-info glyphicon glyphicon-edit"></button>'
						}
					}, {
						title: '删除',
						align: 'center',
						formatter: function(value, row, index) {
							return '<button onclick="sysorderadelet(' + row.oid + ')" class="btn btn-danger glyphicon glyphicon-trash"></button>'
						}
					}]
				});

				$("#tab1").bootstrapTable({
					url: "sysorder/truck_dimall.lgg",
					pagination: true,
					pageSize: 5,
					queryParams: queryParams,
					columns: [{
						field: 'license',
						title: '车辆牌号',
						align: 'center',
					}, {
						field: 'trucktype',
						title: '车辆类型',
						align: 'center',
					}, {
						field: 'carry_capcty',
						title: '吨位',
						align: 'center',
					}, {
						field: 'name',
						title: '车辆所有权',
						align: 'center',
					}]
				});

				$("#tab2").bootstrapTable({
					url: "sysorder/driver_dimall.lgg",
					pagination: true,
					pageSize: 5,
					queryParams: queryParams,
					columns: [{
						field: 'name',
						title: '司机姓名',
						align: 'center',
					}, {
						field: 'license',
						title: '驾驶证',
						align: 'center',
					}, {
						field: 'contact',
						title: '联系电话',
						align: 'center',
					}]
				});

				$("#tab3").bootstrapTable({
					url: "sysorder/thirdpartyall.lgg",
					pagination: true,
					pageSize: 5,
					queryParams: queryParams,
					columns: [{
						field: 'name',
						title: '承运商名称',
						align: 'center',
					}, {
						field: 'address',
						title: '地址',
						align: 'center',
					}, {
						field: 'contact',
						title: '联系人',
						align: 'center',
					}]
				});

			});

			function sysorderadelet(oid) {
				
				$.ajax({
					type: "post",
					url: "sysorder/sysorderdele.lgg",
					data: "oid=" + oid,
					success: function(data) {
						$("#tab").bootstrapTable('refresh')
					}
				});
			}

			$.getJSON("sysorder/order_statusall.lgg", function(data) {

				for(var i = 0; i < data.length; i++) {
					$("#order_status").append("<option value='" + data[i].sid + "'>" + data[i].statusname + "</option>")
				}

			})
			
			$.getJSON("sysorder/owner_type_dimall.lgg", function(data) {

				for(var i = 0; i < data.length; i++) {
					$("#owner_type_id").append("<option value='" + data[i].owner_type_id + "'>" + data[i].name + "</option>")
				}

			})

			function select() {
				$("#tab").bootstrapTable('refresh')
				$("#tab1").bootstrapTable('refresh')
				$("#tab2").bootstrapTable('refresh')
				$("#tab3").bootstrapTable('refresh')
			}

			function queryParams(Params) {
				return {
					'cus_order_no': $("#cus_order_no").val(),
					'createperson': $("#createperson").val(),
					'order_status': $("#order_status").val(),
					'license': $("#license").val(),
					'carry_capcty': $("#carry_capcty").val(),
					'trucktype': $("#trucktype").val(),
					'owner_type_id': $("#order_status").val(),
				}
			}

			function closee() {
				$("#myModal1").modal("hide")
				$("#myModal2").modal("hide")
				$("#myModal3").modal("hide")

			}
		</script>
	</head>

	<body>

		<!-- Button trigger modal -->

		<!-- Modal -->
		<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
			<div class="modal-dialog" role="document" style="width:1500px;height: 600px;">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
						<h4 class="modal-title" id="myModalLabel">创建一个新的调度单号</h4>
					</div>
					<div class="modal-body">

						<div align="left">
							<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal1">指定车辆牌号</button>

							<!-- Modal -->
							<div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
								<div class="modal-dialog" role="document" style="width:1100px">
									<div class="modal-content">
										<div class="modal-header">
											<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
											<h4 class="modal-title" id="myModalLabel">指定车辆牌号</h4>
										</div>
										<div class="modal-body">

											<div align="center">
												 
													<div class="form-group">
														<label for="exampleInputEmail2">车辆牌号：</label>
														<input type="text" class="form-control" id="license" name="license" placeholder="请输入车辆牌号">
														<label for="exampleInputEmail2">车辆吨位：</label>
														<input type="text" class="form-control" id="carry_capcty" name="carry_capcty" placeholder="请输入车辆吨位">
														<label for="exampleInputEmail2">车辆类型：</label>
														<select class="form-control" id="trucktype" name="trucktype">
															<option value="">请选择车辆状态</option>
														</select>
														<label for="exampleInputEmail2">车辆所属公司：</label>
														<select class="form-control" id="owner_type_id" name="owner_type_id">
															<option value="">请选择状态</option>
														</select>
														<button type="button" class="btn btn-default glyphicon glyphicon-search" onclick="select()"></button>
													</div>
												</form>
											</div>

											<table id="tab1" class="table table-striped"></table>

										</div>
										<div class="modal-footer">
											<button type="button" class="btn btn-default  glyphicon glyphicon-remove" onclick="closee()"></button>
											<button type="button" class="btn btn-primary  glyphicon glyphicon-ok"></button>
										</div>
									</div>
								</div>
							</div>

						</div>

						<div align="left">
							<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal2">指定车辆牌号</button>

							<div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
								<div class="modal-dialog" role="document" style="width:1100px">
									<div class="modal-content">
										<div class="modal-header">
											<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
											<h4 class="modal-title" id="myModalLabel">指定车辆牌号</h4>
										</div>
										<div class="modal-body">

											<table id="tab2" class="table table-striped"></table>

										</div>
										<div class="modal-footer">
											<button type="button" class="btn btn-default  glyphicon glyphicon-remove" onclick="closee()"></button>
											<button type="button" class="btn btn-primary  glyphicon glyphicon-ok"></button>
										</div>
									</div>
								</div>
							</div>

						</div>

						<div align="left">
							<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal3">承运商信息</button>

							<div class="modal fade" id="myModal3" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
								<div class="modal-dialog" role="document" style="width:1100px">
									<div class="modal-content">
										<div class="modal-header">
											<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
											<h4 class="modal-title" id="myModalLabel">指定车辆牌号</h4>
										</div>
										<div class="modal-body">

											<table id="tab3" class="table table-striped"></table>

										</div>
										<div class="modal-footer">
											<button type="button" class="btn btn-default glyphicon glyphicon-remove" onclick="closee()"></button>
											<button type="button" class="btn btn-primary  glyphicon glyphicon-ok"></button>
										</div>
									</div>
								</div>
							</div>

						</div>

					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default glyphicon glyphicon-remove" data-dismiss="modal"></button>
						<button type="button" class="btn btn-primary  glyphicon glyphicon-ok"></button>
					</div>
				</div>
				<!-- /.modal-content -->
			</div>
			<!-- /.modal-dialog -->
		</div>
		<!-- /.modal -->

		<div align="center">
			<form class="form-inline" id="for">
				<div class="form-group">
					<label for="exampleInputEmail2">订 单  编 号：</label>
					<input type="text" class="form-control" id="cus_order_no" name="cus_order_no" placeholder="请输入订单编号">
					<label for="exampleInputEmail2">客 户  名 称：</label>
					<input type="text" class="form-control" id="createperson" name="createperson" placeholder="请输入客户名称">
					<label for="exampleInputEmail2">订 单  状 态：</label>
					<select class="form-control" id="order_status" name="order_status">
						<option value="">请选择状态</option>
					</select>
					<button type="button" class="btn btn-default glyphicon glyphicon-search" onclick="select()"></button>
					<button type="button" class="btn btn-primary  glyphicon glyphicon-plus" data-toggle="modal" data-target="#myModal"></button>
				</div>
			</form>
		</div>

		<table id="tab" class="table table-striped">

		</table>

	</body>

</html>